package com.xxl.job.executor.mvc.controller;

import com.xxl.job.executor.service.WebReportApiService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 返回数据共享相关信息
 */
@RestController
@RequestMapping("/api/webreport")
public class WebController {

    @Resource
    private WebReportApiService webReportApiService;

    /**
     * 所有统计
     *
     * @return
     */
    @RequestMapping("/count")
    public String getAllTotal() {
        String result = webReportApiService.getAllTotal();
        return result;
    }

    /**
     * 应用调用服务排名
     *
     * @return
     */
    @RequestMapping("/app_req_rank")
    public String getAppRequestRank() {
        String result = webReportApiService.getAppRequestRank();
        return result;
    }

    /**
     * 应用订阅服务排名
     *
     * @return
     */
    @RequestMapping("/app_sub_rank")
    public String getAppSubscribeRank() {
        String result = webReportApiService.getAppSubscribeRank();
        return result;
    }

    /**
     * 部门订阅服务排名
     *
     * @return
     */
    @RequestMapping("/dep_sub_rank")
    public String getDepartSubscribeRank() {
        String result = webReportApiService.getDepartSubscribeRank();
        return result;
    }

    /**
     * 部门调用服务排名
     *
     * @return
     */
    @RequestMapping("/dep_req_rank")
    public String getDepartRequestRank() {
        String result = webReportApiService.getDepartRequestRank();
        return result;
    }

    /**
     * 服务授权应用排名
     *
     * @return
     */
    @RequestMapping("/auth_app_rank")
    public String getAuthorizeApplicationRank() {
        String result = webReportApiService.getAuthorizeApplicationRank();
        return result;
    }
}
